<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>日志中心</title>
    <link rel="stylesheet" href="lib/layui/css/layui.css"/>
</head>
<body>
<div>
    <div class="layui-row">
        <div class="layui-col-sm8 layui-col-sm-offset2">
            <table id="logTable" lay-filter="logTable"></table>
        </div>
    </div>
</div>
<script type="text/javascript" src="lib/layui/layui.js"></script>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.cookie.js"></script>
<script type="text/javascript" src="js/sha.js"></script>
<script type="text/javascript" src="js/app.js"></script>
<script type="text/html" id="typeTpl">
    {{#  if(d.event_type ==1){ }}
    <span>系统事件</span>
    {{#  }else if(d.event_type ==2){ }}
    <span>设备事件</span>
    {{#  }else if(d.event_type ==3){ }}
    <span>用户登录/登出</span>
    {{#  } }}
</script>
<script type="text/html" id="sourceTpl">
    {{#  if(d.source_type ==1){ }}
    <span>本地WEB</span>
    {{#  }else if(d.source_type ==2){ }}
    <span>接口远程控制</span>
    {{#  }else if(d.source_type ==3){ }}
    <span>集控服务器控制</span>
    {{#  }else if(d.source_type ==4){ }}
    <span>自动控制</span>
    {{#  }else if(d.source_type ==5){ }}
    <span>面板控制</span>
    {{#  } }}
</script>
<script>
    layui.use('table', function () {
        var table = layui.table;

        //第一个实例
        table.render({
            elem: '#logTable'
            , height: 600
            ,method:'POST'
            ,contentType: 'application/json'
            , url: '/log/list' //数据接口
            , page: true //开启分页
            , cols: [[
                {field: 'user', title: '操作人', width: 140},
                {field: 'event_type', title: '事件类型', width: 140, templet: '#typeTpl'},
                {field: 'source_type', title: '事件来源', width: 140, templet: '#sourceTpl'},
                {field: 'desc', title: '事件描述'},
                {field: 'create_time', title: '事件时间'}
            ]]
        });

    });
</script>
</body>
</html>